package com.ep.appupdatedemo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.ep.appupdatedemo.update.AppUtils;
import com.ep.appupdatedemo.update.DownloadApkService;
import com.ep.appupdatedemo.update.ShareUtil;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ShareUtil.init(this);

    }

    public void updateVersion(View view){
        //若是6.0以上版本需增加动态权限
        if (Float.valueOf(AppUtils.getAppVersionName(this))<2){
            Intent intent=new Intent(this, DownloadApkService.class);
            intent.putExtra(DownloadApkService.DOWNLOAD_URL,"http://www.huiqu.co/public/download/apk/huiqu.apk");
            startService(intent);
        }
    }
}
